﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KNXObjects
{
    public class StringObject : GenericObjectBase<StringBuilder>
    {
        #region ObjectBase Implementations

        public override string DataPointEISName
        {
            get { return "EIS15"; }
        }

        public override string DataPointID
        {
            get { return "16.000"; }
        }

        public override string ToString()
        {
            return Value.ToString();
        }

        public override StringBuilder Value
        {
            get
            {
                return base.Value;
            }
            set
            {
                if (value.Length > 14)
                    throw new ApplicationException("StringObject: Bad value (too long). Val : " + value);
                base.Value = value;
            }
        }

        public override void SetValue(string value)
        {
            Value = new StringBuilder(value);
        }
        #endregion

        #region ctor

        public StringObject(string id, string address, string name, string flags)
            : base(id, address, name, flags)
        {
        }

        public StringObject(string value)
        {
            Value = new StringBuilder(value);
        }
        #endregion

    }
}
